import {AzraelFrameWorkComponent} from "../Base/AzraelFrameWork";
import SettingHelperBase from "./SettingHelperBase";
import {ISettingManager} from "../../src/Setting/ISettingManager";
import {SettingManager} from "../../src/Setting/SettingManager";
import GameFrameworkEntry from "../../src/Base/GameFrameworkEntry";
import property = cc._decorator.property;
import ccclass = cc._decorator.ccclass;

@ccclass
export class SettingComponent extends AzraelFrameWorkComponent {
    private _settingHelper: SettingHelperBase;
    private _settingManager: ISettingManager;

    @property(cc.String)
    private _SettingHelperName:string = "DefaultSettingHelper";

    protected onLoad(): void {
        super.onLoad();
        // this._settingManager = GameFrameworkEntry.GetModule(SettingManager);
        // this._settingHelper = <any>cc.js.getClassByName(this._SettingHelperName);
        // this._settingManager.SetSettingHelper( this._settingHelper);
    }

    get Count(): number {
        return this._settingManager.Count;
    }

    GetAllSettingNames(): string[] {
        return  this._settingManager.GetAllSettingNames();
    }

    GetBool(settingName: string): boolean {
        return this._settingManager.GetBool(settingName)
    }

    GetNumber(settingName: string): number {
        return this._settingManager.GetNumber(settingName)
    }

    GetObject(settingName: string): any {
        return this._settingManager.GetObject(settingName)
    }

    GetString(settingName: string): string {
        return this._settingManager.GetString(settingName)
    }

    HasSetting(settingName: string): boolean {
        return this._settingManager.HasSetting(settingName)
    }

    Load(): boolean {
        return  this._settingManager.Load();
    }

    RemoveAllSettings(): void {
        this._settingManager.RemoveAllSettings();
    }

    RemoveSetting(settingName: string): boolean {
        return  this._settingManager.RemoveSetting(settingName);
    }

    Save(): boolean {
        return  this._settingManager.Save();
    }

    SetBool(settingName: string, value: boolean): void {
        this._settingManager.SetBool(settingName, value);
    }

    SetNumber(settingName: string, value: number): void {
        this._settingManager.SetNumber(settingName, value);
    }

    SetObject(settingName: string, obj: any): void {
        this._settingManager.SetObject(settingName, obj);
    }

    SetString(settingName: string, value: string): void {
        this._settingManager.SetString(settingName, value);
    }

}